package com.singleton;

import org.junit.Test;

/**
 * @Author WaveHi
 * @Date 7/8/2021 下午 2:35
 * @Version 1.0
 * @Contact HJBWaveHi@163.com
 * @Description 演示单例模式
 */
public class MyClass1 {

    //私有化构造器
    private MyClass1(){};

    //提供实例
    private static MyClass1  mc1;

    //提供访问方式
    public static MyClass1 getInstance() {

        if(mc1 == null) {
            mc1 = new MyClass1();
        }
        return mc1;

    }

    @Test
    public void printD() {

        int i;

        String s1 = "212";


        System.out.println(System.getProperty("user.name"));

    }


}
